<?php

namespace app\modules\Admin\models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;

class wechatModel extends Model
{
    protected $table = 'wechat';
    protected $primaryKey = 'id';


    /**
     * @param DateTimeInterface $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    /**
     * @return array|mixed
     */
    public function getContentArrAttribute()
    {
        $content_arr = [];
        if(!empty($this->attributes['content'])){
            $content_arr = json_decode($this->attributes['content'], true);
        }
        return $content_arr;
    }
}